package io.renren.modules.welderinfo.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.groupinfo.entity.GroupinfoEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.welderinfo.entity.WelderinfoEntity;
import io.renren.modules.welderinfo.service.WelderinfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-12-28 17:19:49
 */
@RestController
@RequestMapping("welderinfo/welderinfo")
public class WelderinfoController {
    @Autowired
    private WelderinfoService welderinfoService;

    @GetMapping("getwelderinfo")
    public List<WelderinfoEntity> getwelderinfo(@RequestParam(value = "welderId",required = false) String welderId, @RequestParam(value = "welderName",required = false) String welderName,@RequestParam(value = "groupName",required = false) String groupName,@RequestParam(value = "cardType",required = false) String cardType){
        return welderinfoService.getwelderinfo(welderId,welderName,groupName,cardType);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("welderinfo:welderinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = welderinfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{welderid}")
    @RequiresPermissions("welderinfo:welderinfo:info")
    public R info(@PathVariable("welderid") String welderid){
		WelderinfoEntity welderinfo = welderinfoService.getById(welderid);
        return R.ok().put("welderinfo", welderinfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("welderinfo:welderinfo:save")
    public R save(@RequestBody WelderinfoEntity welderinfo){
		welderinfoService.save(welderinfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("welderinfo:welderinfo:update")
    public R update(@RequestBody WelderinfoEntity welderinfo){
		welderinfoService.updateById(welderinfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("welderinfo:welderinfo:delete")
    public R delete(@RequestBody Integer[] welderids){
		welderinfoService.removeByIds(Arrays.asList(welderids));

        return R.ok();
    }

}
